<template>
	<div>
		<el-breadcrumb separator-class="el-icon-arrow-right">
			<el-breadcrumb-item :to="{ path: '/admin' }">管理首页</el-breadcrumb-item>
			<el-breadcrumb-item>分类列表</el-breadcrumb-item>
		</el-breadcrumb>
		<template>
			<el-table v-loading="tableDataLoading" :data="tableData" border style="width: 100%;margin-top:30px">
				<el-table-column prop="id" label="id"></el-table-column>
				<el-table-column prop="title" label="文章名称"></el-table-column>
				<el-table-column prop="content" label="文章内容" ></el-table-column>
				<el-table-column prop="type" label="文章类型"></el-table-column>
				<el-table-column prop="node" label="操作">
					<template slot-scope="scope">       
						<el-button type="text" @click="setBlogList('admin/setBlogList',scope.row)">修改</el-button>
						<el-button type="text" @click="removeCategoryDetil('admin/removeCategoryDetil',scope.row)">删除</el-button>
					</template>
				</el-table-column>
			</el-table>
		</template>
	</div>

</template>

<script>
export default {
  data() {
    return {
      userName: {},
      tableDataLoading: true,
      tableData: []
    };
  },
  created() {},
  mounted() {
    this.getCategory("admin/getBlog_list");
  },
  components: {},
  computed: {},
  methods: {
    getCategory: async function(url, data) {
      let _this = this;
      let response = await _this.http.get(url, data, _this);
      // console.log(response);
      _this.tableData = response.data.data;
      // _this.saverFn.httpSuccess(_this, response, null, function() {
      _this.tableDataLoading = false;
      // });
    },
    setBlogList: function(url, data) {
      let _this = this;
      _this.saverFn.local.set("setBlogList", data);
      _this.$router.push({ path: "/admin/blog_add?set=1" });
    },
    removeCategoryDetil: async function(url, data) {
      let _this = this;
      _this.tableDataLoading = true;
      let response = await _this.http.post(url, data);
      _this.saverFn.httpSuccess(_this, response, null, function() {
        _this.tableDataLoading = false;
        _this.getCategory("admin/getBlog_list");
      });
    }
  }
};
</script>
<style lang="less" scoped>
@import "../../public/pubilcColor.less";

.el-breadcrumb {
  background: @bgcolor;
  padding: 10px 15px;
  border-radius: 5px;
}
.el-table .warning-row {
  background: oldlace;
}

.el-table .success-row {
  background: #f0f9eb;
}
</style>
<style>
.el-table .cell {
  max-height: 69px;
}
</style>
